package com.smart.controller;

import com.smart.common.WebResponse;
import com.smart.common.annotation.WebAccess;
import com.smart.model.request.*;
import com.smart.service.CreatExcelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * @author: zyh
 * @date: 2023-07-04
 */
@RestController
@RequestMapping("/excel")
@Api(tags = {"A通用模块#excel下载模块"})
public class CreatExcelController {

    @Autowired
    private CreatExcelService creatExcelService;

    @WebAccess(login = true)
    @ApiOperation("云服务-动火作业导出")
    @PostMapping("/serviceHotWorkExcelImport")
    public void serviceHotWorkExcelImport(@RequestBody HotWorkRequest request, HttpServletResponse response) {
        creatExcelService.serviceHotWorkExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云服务-工地人员台账导出")
    @PostMapping("/serviceUserExcelExport")
    public void serviceUserExcelExport(@RequestBody ManageUserRegistrationRequest request, HttpServletResponse response) {
        creatExcelService.serviceUserExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云服务-临时人员进出场纪录导出")
    @PostMapping("/serviceTempUserExcelExport")
    public void serviceTempUserExcelExport(@RequestBody ManageTempUserRegistrationRequest request, HttpServletResponse response) {
        creatExcelService.serviceTempUserExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云管理-动火作业导出")
    @PostMapping("/manageHotWorkExcelExport")
    public void manageHotWorkExcelExport(@RequestBody HotWorkRequest request, HttpServletResponse response) {
        creatExcelService.manageHotWorkExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云管理平台-建筑工地人员台账导出")
    @PostMapping("/manageUserExcelExport")
    public void manageUserExcelExport(@RequestBody ManageUserRegistrationRequest request, HttpServletResponse response) {
        creatExcelService.manageUserExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云管理-临时人员进出场纪录导出")
    @PostMapping("/manageTempUserExcelExport")
    public void manageTempUserExcelExport(@RequestBody ManageTempUserRegistrationRequest request, HttpServletResponse response) {
        creatExcelService.manageTempUserExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-动火作业导出")
    @PostMapping("/superviseHotWorkExcelExport")
    public void superviseHotWorkExcelExport(@RequestBody HotWorkRequest request, HttpServletResponse response) {
        creatExcelService.superviseHotWorkExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-动火作业管理列表导出")
    @PostMapping("/superviseManageHotWorkExcelExport")
    public void superviseManageHotWorkExcelExport(@RequestBody HotWorkRequest request, HttpServletResponse response) {
        creatExcelService.superviseManageHotWorkExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-临时人员进出项目纪录导出-根据人员信息查询页面")
    @PostMapping("/supervisePersonTempUserExcelExport")
    public void supervisePersonTempUserExcelExport(@RequestBody ManageTempUserRegistrationRequest request, HttpServletResponse response) {
        creatExcelService.supervisePersonTempUserExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-项目周报列表导出（项目周报台账）")
    @PostMapping("/projectWeeklyReportExcelExport")
    public WebResponse<String> projectWeeklyReportExcelExport(@RequestBody ProjectWeeklyTaskRequest request, HttpServletResponse response) {
        return new WebResponse(creatExcelService.projectWeeklyReportExcelExport(request, response));
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-周报任务提交名单")
    @PostMapping("/projectListWeeklyReportExcelExport")
    public void projectListWeeklyReportExcelExport(@RequestBody ProjectWeeklyTaskRequest request, HttpServletResponse response) {
        creatExcelService.projectListWeeklyReportExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-临时任务提报台账导出")
    @PostMapping("/projectTempReportExcelExport/{tempTaskId}")
    public void projectTempReportExcelExport(@PathVariable("tempTaskId") long tempTaskId, HttpServletResponse response) {
        creatExcelService.projectTempReportExcelExport(tempTaskId, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-临时任务任务提交名单")
    @PostMapping("/projectListTempReportExcelExport")
    public void projectListTempReportExcelExport(@RequestBody ProjectReportStatisticsRequest request, HttpServletResponse response) {
        creatExcelService.projectListTempReportExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-文件接收项目名单")
    @PostMapping("/projectListFileExcelExport")
    public void projectListFileExcelExport(@RequestBody ProjectFileTaskRequest request, HttpServletResponse response) {
        creatExcelService.projectListFileExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-项目临时人员进出项目纪录导出-根据项目信息查询页面")
    @PostMapping("/superviseProjectTempUserExcelExport")
    public void superviseProjectTempUserExcelExport(@RequestBody ManageTempUserRegistrationRequest request, HttpServletResponse response) {
        creatExcelService.superviseProjectTempUserExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-项目名单导出")
    @PostMapping("/superviseProjectExcelExport")
    public void superviseProjectExcelExport(@RequestBody ProjectRequest request, HttpServletResponse response) {
        creatExcelService.superviseProjectExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管-项目人员统计导出")
    @PostMapping("/supervisePersonExcelExport")
    public void supervisePersonExcelExport(@RequestBody ProjectRequest request, HttpServletResponse response) {
        creatExcelService.supervisePersonExcelExport(request, response);
    }

    @WebAccess(login = true)
    @ApiOperation("云监管平台-建筑工地人员台账导出")
    @PostMapping("/superviseUserExcelExport")
    public void superviseUserExcelExport(@RequestBody ManageUserRegistrationRequest request, HttpServletResponse response) {
        creatExcelService.superviseUserExcelExport(request, response);
    }

}
